package com.lkd.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.lkd.contract.SupplyContract;
import com.lkd.contract.VmStatusContract;
import com.lkd.entity.TaskEntity;
import com.lkd.http.vo.CancelTaskVo;
import com.lkd.http.vo.TaskReportInfoVO;
import com.lkd.http.vo.TaskViewModel;
import com.lkd.vo.Pager;

import java.util.List;

/**
 * 工单业务逻辑
 */
public interface TaskService extends IService<TaskEntity> {

    /**
     * 分页查询
     * @param pageIndex
     * @param pageSize
     * @param innerCode
     * @param userId
     * @param taskCode
     * @param status
     * @param isRepair
     * @param start
     * @param end
     * @return
     */
    Pager<TaskEntity> search(Long pageIndex, Long pageSize, String innerCode, Integer userId, String taskCode, Integer status, Boolean isRepair, String start, String end);

    /**
     * 创建工单
     * @param taskViewModel
     * @return
     */
    Boolean create(TaskViewModel taskViewModel,Integer assignorId);

    /**
     * 接受工单
     * @param taskId
     * @return
     */
    Boolean accept(Long taskId, Integer loginUserId);

    /**
     * 取消，拒绝工单
     * @param taskId
     * @return
     */
    Boolean cancel(Long taskId, Integer loginUserId, CancelTaskVo cancelTaskVo);

    /**
     * 完成工单
     * @param taskId
     * @return
     */
    Boolean complete(Long taskId, Integer loginUserId);

    List<TaskReportInfoVO> taskReportInfo(String start, String end);

    /**
     * 创建自动维修工单
     * @param statusContract
     */
    void createRepairTaskAuto(VmStatusContract statusContract);

    /**
     * 自动创建补货工单
     * @param contract
     */
    void createSupplyAuto(SupplyContract contract);
}
